/**
 * 相关代码来自https://www.jianshu.com/p/1b1ec73b2243
 *
 * 也可以使用react-native-root-toast
 */


import React from 'react';
import RootView from './RootView'
import ToastView from './ToastView'

class Toast {
    static LONG = 2000;
    static SHORT = 1000;

    static show(msg) {
        RootView.setView(<ToastView
            message={msg}
            onDismiss={() => {
                RootView.setView()
            }}/>)
    }

    static show(msg, time) {
        RootView.setView(<ToastView
            message={msg}
            time={time}
            onDismiss={() => {
                RootView.setView()
            }}/>)
    }
}

export default Toast